mod utils;
mod enumm;
mod structt;
mod attr;

use syn::{parse_macro_input, DeriveInput};

#[proc_macro_derive(Responser, attributes(response))]
pub fn derive_responder(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    let input = parse_macro_input!(input as DeriveInput);

    match input.data {
        syn::Data::Enum(e) => enumm::derive_responder(e, input.ident, input.attrs).into(),
        syn::Data::Struct(s) => structt::derive_responder(s, input.ident, input.attrs).into(),
        _ => panic!("#[derive(Responser)] only supports enums"),
    }
}
